package com.ponhu.ea2.stockcenter.provider.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ponhu.ea2.stockcenter.dto.StockQueryListDTO;
import com.ponhu.ea2.stockcenter.provider.entity.StockInventoryReal;
import com.ponhu.ea2.stockcenter.provider.support.vo.GoodsCenterInventoryVO;
import com.ponhu.ea2.stockcenter.provider.support.vo.InventoryVO;
import com.ponhu.ea2.stockcenter.vo.StockQueryListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Entity com.ponhu.ea2.stockcenter.provider.entity.StockInventoryReal
 */
@Mapper
public interface StockInventoryRealMapper extends BaseMapper<StockInventoryReal> {

    /**
     * 获取商品关联的货品数据
     * @param page
     * @return
     */
    public IPage<InventoryVO> selectInventoryByPage(Page<InventoryVO> page);

    /**
     * 分页获取货品数据
     * @param page
     * @return
     */
    public IPage<InventoryVO> selectInventoryPage(Page<InventoryVO> page);

    /**
     * 计算货品总数量
     * @return
     */
    public Integer calcInventoryCount();

    List<StockQueryListVO> getAllInventoryStocks(@Param("dto") StockQueryListDTO stockQueryListDTO,
                                                 @Param("offset") Integer offset, @Param("limit") Integer limit);

    Long countAllInventoryStocks(@Param("dto") StockQueryListDTO stockQueryListDTO);

    /**
     * 根据货品编码列表查询商品中心货品数据
     * @param inventoryCodeList
     * @return
     */
    List<GoodsCenterInventoryVO> getInventoryByInventoryCodeList(List<String> inventoryCodeList);

    /**
     * 修复销售层占用数
     * @param inventoryCodeList
     */
    void updateSalesUsedStockNum(List<String> inventoryCodeList);

    /**
     * 根据仓库可售仓数据更新销售层可售数
     */
    void updateStockSalesNum();


}




